package com.hstcs.components;

import com.badlogic.ashley.core.Component;

public class StateComponent implements Component {
	private int state = 0;
	public float time = 0.0f;
	public  int lastState = 0;
	public boolean finish = false;
	public int get() {
		return state;
	}
	
	public void add(int newState) {
		state |= newState;
		time = 0.0f;
	}
	
	public void set(int newState){
		state = newState;
	}
	
	public boolean equal(int state1){
		if( state == state1) return true;
		return false;
	}
	public boolean have(int state1){
		if((state & state1) > 0)return true;	
		return false;
	}
	public void remove(int newState){
		state &= (~ newState);
	}
	
	public void finish(){
		set(lastState);
	}
}
